package com.yycx.module.bus.provider.controller;

import com.yycx.common.mybatis.model.ResultBody;
import com.yycx.common.springmvc.base.BaseController;
import com.yycx.module.bus.client.entity.*;
import com.yycx.module.bus.provider.service.*;
import com.yycx.module.bus.provider.service.hy.HyOrderService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;


/**
 * 销售单控制器
 *
 * @author flyme
 * @date 2020-08-17
 */
@RestController
@RequestMapping("/bus/order/")
public class BusOrderController extends BaseController<BusOrderService, BusOrder> {

    @Autowired
    private HyOrderService hyOrderService;

    @ApiOperation(value = "销售单-分页列表", notes = "销售单分页列表")
    @GetMapping(value = "page")
    public ResultBody pageList(@RequestParam(required = false) Map params) {
        //List<HyOrder> list=hyOrderService.list();
        return bizService.pageList(params);
    }

    @ApiOperation(value = "销售单-列表", notes = "销售单列表")
    @GetMapping(value = "list")
    public ResultBody list(@RequestParam(required = false) Map params) {
        return bizService.listEntityMap(params);
    }

    @ApiOperation(value = "销售单-添加", notes = "添加销售单")
    @PostMapping(value = "save")
    public ResultBody save(@RequestParam(required = false) Map params) {
        return bizService.add(params);
    }

    @ApiOperation(value = "销售单-更新", notes = "更新销售单")
    @PostMapping(value = "update")
    //@CacheEvict(value= "order",key = "#params['id']")
    public ResultBody update(@RequestParam(required = false) Map params) {
        return bizService.edit(params);
    }

    @ApiOperation(value = "销售单-删除", notes = "删除销售单")
    @PostMapping(value = "remove")
    public ResultBody remove(@RequestParam(required = false) Map params) {
        return bizService.delete(params);
    }


    @ApiOperation(value = "销售单-详情", notes = "销售单详情")
    @GetMapping(value = "get")
    //@Cacheable(value= "order",key = "#params['orderId']")
    public ResultBody get(@RequestParam(required = false) Map params) {
        return bizService.get(params);
    }

    @ApiOperation(value = "获取打印信息", notes = "获取打印信息")
    @GetMapping(value = "getPrintInfo")
    public ResultBody getPrintInfo(Long orderId) {
        return bizService.getPrintInfo(orderId);
    }

    @ApiOperation(value = "统计首页信息", notes = "统计首页信息")
    @GetMapping(value = "totalCount")
    public ResultBody totalCount() {
        return bizService.totalCount();
    }



    @ApiOperation(value = "查询保证金关联订单", notes = "查询保证金关联订单")
    @GetMapping(value = "selectCustomBondOrderList")
    public ResultBody returnList(@RequestParam(required = false) Long paymentId) {

        return ResultBody.ok(null);
    }



    @PostMapping(value = "updatePrintTag")
    public ResultBody updatePrintTag(@RequestParam Long orderId) {
        Boolean tag= bizService.updatePrintTag(orderId);
        return  ResultBody.ok();
    }

}
